int findPoisonedDuration(vector<int>& timeSeries, int duration) {
    int sum = duration;
    for (int i = 1; i < timeSeries.size(); i++)
    {
        if (timeSeries[i - 1] + duration > timeSeries[i])
        {
            sum += timeSeries[i] - timeSeries[i - 1];
        }
        else
        {
            sum += duration;
        }
    }

    return sum;
}    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
    int sum = duration;
    for (int i = 1; i < timeSeries.size(); i++)
    {
        if (timeSeries[i - 1] + duration > timeSeries[i])
        {
            sum += timeSeries[i] - timeSeries[i - 1];
        }
        else
        {
            sum += duration;
        }
    }

    return sum;
}    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
    int sum = duration;
    for (int i = 1; i < timeSeries.size(); i++)
    {
        if (timeSeries[i - 1] + duration > timeSeries[i])
        {
            sum += timeSeries[i] - timeSeries[i - 1];
        }
        else
        {
            sum += duration;
        }
    }

    return sum;
}